import datetime

class StatusMiddleware(object):
    def process_request(self, request):
        if request.user.is_authenticated():
            request.user.last_login = datetime.datetime.now()
            request.user.save()